<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>3、两个数组的交集</title>
</head>

<body>
  <script>
    function array(i, j) {
      //转数组去重， 创建的一个新数组，返回一个
      return [...new Set(i)].filter((item) => {
        // 查看是否包含
        return j.includes(item);
      })

    }
    console.log(array([1, 1, 2, 3], [1, 1, 2]))
  </script>
</body>

</html>